home *** CD-ROM | disk | FTP | other *** search
/ Visual Cafe 3 / Visual Cafe 3.ISO / Vcafe / Main.bin / DataInput.java < prev    next >
Text File  |  1998-09-22  |  7KB  |  201 lines

  1. /*
  2.  * @(#)DataInput.java    1.9 98/07/01
  3.  *
  4.  * Copyright 1995-1998 by Sun Microsystems, Inc.,
  5.  * 901 San Antonio Road, Palo Alto, California, 94303, U.S.A.
  6.  * All rights reserved.
  7.  * 
  8.  * This software is the confidential and proprietary information
  9.  * of Sun Microsystems, Inc. ("Confidential Information").  You
  10.  * shall not disclose such Confidential Information and shall use
  11.  * it only in accordance with the terms of the license agreement
  12.  * you entered into with Sun.
  13.  */
  14.  
  15. package java.io;
  16.  
  17. /**
  18.  * The data input interface is implemented by streams that can read 
  19.  * primitive Java data types from a stream in a machine-independent 
  20.  * manner. 
  21.  *
  22.  * @author  Frank Yellin
  23.  * @version 1.9, 07/01/98
  24.  * @see     java.io.DataInputStream 
  25.  * @see     java.io.DataOutput  
  26.  * @since   JDK1.0
  27.  */
  28. public
  29. interface DataInput {
  30.     /**
  31.      * Reads <code>b.length</code> bytes into the byte array. This 
  32.      * method blocks until all the bytes are read. 
  33.      *
  34.      * @param     b   the buffer into which the data is read.
  35.      * @exception  EOFException  if this stream reaches the end before reading
  36.      *               all the bytes.
  37.      * @exception  IOException   if an I/O error occurs.
  38.      * @since      JDK1.0
  39.      */
  40.     void readFully(byte b[]) throws IOException;
  41.  
  42.     /**
  43.      * Reads <code>b.length</code> bytes into the byte array. This 
  44.      * method blocks until all the bytes are read. 
  45.      *
  46.      * @param     b   the buffer into which the data is read.
  47.      * @exception  EOFException  if this stream reaches the end before reading
  48.      *               all the bytes.
  49.      * @exception  IOException   if an I/O error occurs.
  50.      * @since   JDK1.0
  51.      */
  52.     void readFully(byte b[], int off, int len) throws IOException;
  53.  
  54.     /**
  55.      * Skips exactly <code>n</code> bytes of input. 
  56.      *
  57.      * @param      n   the number of bytes to be skipped.
  58.      * @return     the number of bytes skipped, which is always <code>n</code>.
  59.      * @exception  EOFException  if this stream reaches the end before skipping
  60.      *               all the bytes.
  61.      * @exception  IOException   if an I/O error occurs.
  62.      * @since      JDK1.0
  63.      */
  64.     int skipBytes(int n) throws IOException;
  65.  
  66.     /**
  67.      * Reads a <code>boolean</code> value from the input stream. 
  68.      *
  69.      * @return     the <code>boolean</code> value read.
  70.      * @exception  EOFException  if this stream reaches the end before reading
  71.      *               all the bytes.
  72.      * @exception  IOException   if an I/O error occurs.
  73.      * @since      JDK1.0
  74.      */
  75.     boolean readBoolean() throws IOException;
  76.  
  77.     /**
  78.      * Reads a signed 8-bit value from the input stream. 
  79.      *
  80.      * @return     the 8-bit value read.
  81.      * @exception  EOFException  if this stream reaches the end before reading
  82.      *               all the bytes.
  83.      * @exception  IOException   if an I/O error occurs.
  84.      * @since      JDK1.0
  85.      */
  86.     byte readByte() throws IOException;
  87.  
  88.     /**
  89.      * Reads an unsigned 8-bit value from the input stream. 
  90.      *
  91.      * @return     the unsigned 8-bit value read.
  92.      * @exception  EOFException  if this stream reaches the end before reading
  93.      *               all the bytes.
  94.      * @exception  IOException   if an I/O error occurs.
  95.      * @since      JDK1.0
  96.      */
  97.     int readUnsignedByte() throws IOException;
  98.  
  99.     /**
  100.      * Reads a 16-bit value from the input stream. 
  101.      *
  102.      * @return     the 16-bit value read.
  103.      * @exception  EOFException  if this stream reaches the end before reading
  104.      *               all the bytes.
  105.      * @exception  IOException   if an I/O error occurs.
  106.      * @since      JDK1.0
  107.      */
  108.     short readShort() throws IOException;
  109.  
  110.     /**
  111.      * Reads an unsigned 16-bit value from the input stream. 
  112.      *
  113.      * @return     the unsigned 16-bit value read.
  114.      * @exception  EOFException  if this stream reaches the end before reading
  115.      *               all the bytes.
  116.      * @exception  IOException   if an I/O error occurs.
  117.      * @since      JDK1.0
  118.      */
  119.     int readUnsignedShort() throws IOException;
  120.  
  121.     /**
  122.      * Reads a Unicode <code>char</code> value from the input stream. 
  123.      *
  124.      * @return     the Unicode <code>char</code> read.
  125.      * @exception  EOFException  if this stream reaches the end before reading
  126.      *               all the bytes.
  127.      * @exception  IOException   if an I/O error occurs.
  128.      * @since      JDK1.0
  129.      */
  130.     char readChar() throws IOException;
  131.  
  132.     /**
  133.      * Reads an <code>int</code> value from the input stream. 
  134.      *
  135.      * @return     the <code>int</code> value read.
  136.      * @exception  EOFException  if this stream reaches the end before reading
  137.      *               all the bytes.
  138.      * @exception  IOException   if an I/O error occurs.
  139.      * @since      JDK1.0
  140.      */
  141.     int readInt() throws IOException;
  142.  
  143.     /**
  144.      * Reads a <code>long</code> value from the input stream. 
  145.      *
  146.      * @return     the <code>long</code> value read.
  147.      * @exception  EOFException  if this stream reaches the end before reading
  148.      *               all the bytes.
  149.      * @exception  IOException   if an I/O error occurs.
  150.      * @since      JDK1.0
  151.      */
  152.     long readLong() throws IOException;
  153.  
  154.     /**
  155.      * Reads a <code>float</code> value from the input stream. 
  156.      *
  157.      * @return     the <code>float</code> value read.
  158.      * @exception  EOFException  if this stream reaches the end before reading
  159.      *               all the bytes.
  160.      * @exception  IOException   if an I/O error occurs.
  161.      * @since      JDK1.0
  162.      */
  163.     float readFloat() throws IOException;
  164.  
  165.     /**
  166.      * Reads a <code>double</code> value from the input stream. 
  167.      *
  168.      * @return     the <code>double</code> value read.
  169.      * @exception  EOFException  if this stream reaches the end before reading
  170.      *               all the bytes.
  171.      * @exception  IOException   if an I/O error occurs.
  172.      * @since      JDK1.0
  173.      */
  174.     double readDouble() throws IOException;
  175.  
  176.     /**
  177.      * Reads the next line of text from the input stream. 
  178.      *
  179.      * @return     if this stream reaches the end before reading all the bytes.
  180.      * @exception  IOException  if an I/O error occurs.
  181.      * @since      JDK1.0
  182.      */
  183.     String readLine() throws IOException;
  184.  
  185.     /**
  186.      * Reads in a string that has been encoded using a modified UTF-8 format.
  187.      * <p>
  188.      * For an exact description of this method, see the discussion in 
  189.      * Gosling, Joy, and Steele, <i>The Java Language Specification</i>. 
  190.      *
  191.      * @return     a Unicode string.
  192.      * @exception  EOFException            if this stream reaches the end
  193.      *               before reading all the bytes.
  194.      * @exception  IOException             if an I/O error occurs.
  195.      * @exception  UTFDataFormatException  if the bytes do not represent a
  196.      *               valid UTF-8 encoding of a string.
  197.      * @since      JDK1.0
  198.      */
  199.     String readUTF() throws IOException;
  200. }
  201.